<template>
  <PCard class="ed1-con" :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="true"
    :bodyStyle="{ width: '100%', position: 'relative' }">
    <div slot="header" class="card-title-detail1">
      <span><span class="icons"></span>{{ qsbDetails.entName || '----' }}</span>
      <a-button @click="goBack" type="primary" style="float: right;">返 回</a-button>
    </div>
    <div class="btn-group">
      <span :key="'btn-group-ed1-' + index" v-for="(item, index) in btnGroupConfig.btnList">
        <a-button v-if="!item.hasDJGS && item.label !=''" :disabled="item.disabled" v-has='item.has' @click="btnGroupEvent(item, index)"
          style="margin: 0 5px;">{{ item.label }}</a-button>
      </span>

      <!-- <a-button @click="btnGroupEvent('申请开票')" style="margin: 0 5px;">申请开票</a-button> -->
    </div>
    <PageForm style="padding: 0 20px;" ref="qyxxForm" :formKey="formKey_qyxx"
      :formEvent="(...args) => { formEvent('qyxxForm', ...args) }" :formConfig="pageFormDefaultConfig"
      :itemList="formList.defaultForm"></PageForm>


    <PCard :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="true" :bodyStyle="{ width: '100%' }">
      <div slot="header" class="card-title-detail2">
        <span>企业信息</span>
        <a-button v-has="'ee_de11:click:yjzl'" @click="mailingInformation" type="link" style="float: right;">邮寄资料 </a-button>
      </div>
      <PageForm ref="qyxxForm" :formKey="formKey_qyxx" :formEvent="(...args) => { formEvent('qyxxForm', ...args) }"
        :formConfig="pageFormDefaultConfig" :itemList="formList.otherForm"></PageForm>
    </PCard>

    <PCard :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="false" :bodyStyle="{ width: '100%' }">
      <div slot="header" class="card-title-detail2">
        <span>经营者关联信息查询</span>
      </div>
      <QueryOperatorRelatedInformation v-model="qoriConfig.list" :defaultValue="qoriConfig.defaultList" :disabled="qoriConfig.disabled" :model="qoriConfig.model" :DisplayWizard="qoriConfig.DisplayWizard"></QueryOperatorRelatedInformation>
    </PCard>
    <PCard v-if="qsbDetails.protocolType=='2'" :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="false" :bodyStyle="{ width: '100%' }">
      <div slot="header" class="card-title-detail2">
        <span>账户信息</span>
      </div>
      <CorporateAccountInformation v-model="caiConfig.value" :disabled="caiConfig.disabled" :model="caiConfig.model" :legalInfo="caiConfig.legalInfo"></CorporateAccountInformation>
    </PCard>


    <PCard :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="true" :bodyStyle="{ width: '100%' }">
      <div slot="header" class="card-title-detail2">
        <span>企业费用说明</span>
      </div>
      <PageForm ref="qyfysmFrom" :formKey="formKey_qyxx" :formEvent="(...args) => { formEvent('qyfysmFrom', ...args) }"
        :formConfig="pageFormDefaultConfig" :itemList="formList.qyfysmFrom"></PageForm>
    </PCard>
    <PCard :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="true" :bodyStyle="{ width: '100%' }">
      <div slot="header" class="card-title-detail2">
        <span>电子税务局密码管理</span>
      </div>
      <ElectronicPasswords v-if='entId' :entId='entId' :entName='qsbDetails.entName'></ElectronicPasswords>
    </PCard>
    <PCard :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="true" :bodyStyle="{ width: '100%' }">
      <div slot="header" class="card-title-detail2">
        <span>发票信息</span>
        <a-button v-for="(item,index) in btnGroupConfig.btnListNew"  @click="btnGroupEvent(item, index)" v-has='item.has'  type="" style="float: right; margin: 0 5px;">{{item.label}} </a-button>
      </div>

      <a-table v-if="sdfpConfig.ticketType == 2 || sdfpConfig.ticketType == 3" :columns="sdfpConfig.columns" :data-source="sdfpConfig.data" bordered :pagination="false">
        <!-- <template slot="action" slot-scope="text, record">
          <a-button :disabled="sdfpConfig.disabled" type="primary" @click="tableEvent_sd(record)">{{sdfpConfig.actionLabel[sdfpConfig['state']]}}</a-button>
        </template> -->
        <template slot="kpxe" slot-scope="text, record">
          <div v-if="sdfpConfig.state=='0'" >{{text=='--'?text : conversionElement1(text)}}</div>
          <div v-if="sdfpConfig.state=='1'" >

            <a-tooltip :trigger="['focus']" placement="topLeft" overlay-class-name="numeric-input">
              <span v-if="sdfpConfig.kpxe" slot="title" class="numeric-input-title">
                {{ `${sdfpConfig.kpxe !== '-' ? formatNumber(sdfpConfig.kpxe) : '-'} 元` }}
              </span>
              <template v-else slot="title">
                填写开票限额（月）
              </template>
              <a-input
                :value="sdfpConfig.kpxe"
                placeholder="填写开票限额（月）"
                :max-length="20"
                style="min-width: 80px;"
                @change="tableItemChange"
                @blur="onBlur"
              />
            </a-tooltip>
          </div>
        </template>
        <template slot="zyje" slot-scope="text, record">
          {{ text=='--'?text : conversionElement1(text)}}
        </template>
        <template slot="syje" slot-scope="text, record">
          {{text=='--'?text :conversionElement1(text)}}
        </template>


      </a-table>

      <a-divider v-if="sdfpConfig.ticketType == 3" />


      <a-table v-if="sdfpConfig.ticketType == 1 || sdfpConfig.ticketType == 3" :columns="fpgl" :data-source="fpglDataSource" bordered :pagination="false" :scroll="{ y: 300 }">
        <!-- <span slot="action" slot-scope=" text,record">
          <a-button type="primary" size="small" @click="tableEvent('fpgl', text, record)">领用</a-button>
        </span> -->
      </a-table>
    </PCard>



    <PCard :isCardBorder="false" :shadow="'never'" :isHeadBottomBorder="true" :bodyStyle="{ width: '100%' }">
      <div slot="header" class="card-title-detail1">
        <span>进行中的服务</span>
        <!-- <a-button @click="goBack" type="link" style="float: right;"  >邮寄资料 </a-button> -->
      </div>
      <!-- :pagination="tableConfig.ipagination"  -->
      <a-table ref="table" bordered rowKey="id" :columns="tableConfig.columns" :dataSource="tableConfig.tableData"
        :loading="tableConfig.loading" @change="handleTableChange"
        :scroll="{ x: 800, y: 500 }">

        <template slot="businessType" slot-scope="text">
          {{ tempDetailConfig.ywlxObj[text] }}
          <!-- {{ text }} -->
        </template>
        <template slot="businessStatus" slot-scope="text">
          {{ tempDetailConfig.ddztObj[text] }}
        </template>

        <span slot="id3" slot-scope="text, record, index,indent"> {{ getStateData('TaskStatus', text, record, indent)
        }}</span>
        <div slot="action" class="avtion-con" slot-scope="text, record, index,indent">
          <a href="javascript:;" v-has="'ee_de11:click:jxzdfwxq'" @click="goTo('1', record, index, indent)">详情</a>
          <!-- <a-divider  type="vertical"/>
              <a href="javascript:;" @click="goTo('2',record, index,indent)">{{getActionLabel(record)}}</a> -->
          <!-- <a href="javascript:;" @click="getActionItem(text, record, index,indent)">{{getActionLabel(record, index,indent)}}</a> -->
        </div>
      </a-table>
    </PCard>
    <p-PreviewShow :showHelp="false" :config="PreviewShowConfig" :url="PreviewShowConfig.url" :name="PreviewShowConfig.name" :vhas="PreviewShowConfig.vhas" :event="PreviewShowEvent"></p-PreviewShow>
    <!-- 当前页面公共弹框 -->
    <a-modal v-model="winConfig.visible" :title="winConfig.title" :footer="null" :width="winConfig.width">
      <component :is="winConfig.componentName" :formInfo="{ ...qsbDetails, entId }" :coloseEvent="winColosedEvent">
      </component>
    </a-modal>
    <EntMobileNumber
      v-if="EntMobileNumberConffig.legalVisibleStatus && EntMobileNumberConffig.entId"
      :visible="EntMobileNumberConffig.legalVisibleStatus"
      :entId="EntMobileNumberConffig.entId"
      :datas="EntMobileNumberConffig.datas"
      @legalModalHidden="legalModalHidden"
    />
  </PCard>
</template>

<script>
import { Storage,conversionElement,conversionBranch } from '@/utils/util'
import UUID from './../../../utils/uuid'
import detailConfig from './util/configData'
import pageEvent from './util/pageEvent'
import ServiceRenew from './component/ServiceRenew.vue'
import MailingInformation from './component/MailingInformation.vue'
import EntMobileNumber from '@/views/common/entMobileNumber'
import ElectronicPasswords from '@/views/electronicPasswords/electronicPasswords'
import completed from './component/completed.vue'

import QueryOperatorRelatedInformation from './../components/QueryOperatorRelatedInformation.vue'
import CorporateAccountInformation from './../components/CorporateAccountInformation.vue'

const screenPixelRatio = () => {
  const devicePixelRatio_ = window.devicePixelRatio
  const screenWidth = window.screen.width
  const oldDevicePixel = devicePixelRatio_ * screenWidth
  const tempList = {
    "1920 1": 4,
    "1280 1.5": 3,
    "1536 1.25": 3,
    "1098 1.75": 2,
  }
  let res = 0
  if (oldDevicePixel >= 1920) {
    res = tempList[`${screenWidth} ${devicePixelRatio_}`]
  }
  return res
}

// console.log(window.screen.width , window.devicePixelRatio);

const formKey_qyxx = UUID()
const pageFormConfig_ = {
  columnCount: 3,
  layout: 'horizontal',
  labelCol: { span: 4 },
  wrapperCol: { span: 4 },
  rowAttr: {
    // type:'',
    // justify:'',
    // gutter:'',
    // align:'',
  },
  celAttr: {
    // flex:'',
    // offset:'',
    // order:'',
    // pull:'',
    // push:'',
    span: 8,
    // xxl:{},
  }
}
// labelCol: { xxl: 10, xl:9 }, wrapperCol: {  xxl: 14, xl: 15 }
const formItemConfig0 = {
  labelAlign: 'left',
  // labelCol: { xxl: 2, xl: 5 },
  // wrapperCol: { xxl: 20, xl: 19 },
  labelCol: { xxl: 6, xl: 5 },
  wrapperCol: { xxl: 18, xl: 19 },
}
const formItemConfig = {
  labelAlign: 'left',
  labelCol: { xxl: 6, xl: 5 },
  wrapperCol: { xxl: 18, xl: 19 },
}
const formItemConfig6 = {
  labelAlign:'left',
  labelCol: { xxl: 7, xl:9 },
  wrapperCol:  { xxl: 17, xl: 15 },
}
const formItemConfig7 = {
  labelAlign:'left',
  labelCol: { xxl: 3, xl:4 },
  wrapperCol:  { xxl: 18, xl: 18 },
}
const formItemConfig2 = {
  labelAlign: 'left',
  labelCol: { xxl: 9, xl: 6 },
  wrapperCol: { xxl: 15, xl: 18 },
}
const formItemConfig3 = {
  labelAlign: 'left',
  labelCol: { xxl: 9, xl: 10 },
  wrapperCol: { xxl: 15, xl: 12 },
}
const formItemConfig1 = {
  labelAlign: 'left',
  labelCol: { span: 2 },
  wrapperCol: { span: 20 },
}

const tableCom = [
          {
            title: '发票类型',
            dataIndex: 'taxType',// 普通 专用
            colSpan: 2,
            width: 80,
            key: 'taxType',

          },
          {
            title: '发票类型',
            dataIndex: 'taxMedium', // 纸质 电子
            colSpan: 0,
            width: 80,
            key: 'taxMedium',

          },
            { title: '核定数量(月)', align: 'center', dataIndex: 'ydhdsl' },
            { title: '上月余量', align: 'center', dataIndex: 'syyl' },
            { title: '本月领用', align: 'center', dataIndex: 'byly' },
            { title: '本月使用', align: 'center', dataIndex: 'bysy' },
            { title: '当月余量', align: 'center', dataIndex: 'dyyl' },
            // { title: '操作', align: 'center', dataIndex: 'action', scopedSlots: { customRender: 'action' }, },
]

// 是否有个税申报 false 没有 true 有
let hasDJGS_ = false


function formatNumber(value) {
  value += '';
  const list = value.split('.');
  const prefix = list[0].charAt(0) === '-' ? '-' : '';
  let num = prefix ? list[0].slice(1) : list[0];
  let result = '';
  while (num.length > 3) {
    result = `,${num.slice(-3)}${result}`;
    num = num.slice(0, num.length - 3);
  }
  if (num) {
    result = num + result;
  }
  return `${prefix}${result}${list[1] ? `.${list[1]}` : ''}`;
}


export default {
  name: 'enterpriseDetails1',
  components: { MailingInformation, ServiceRenew,completed ,EntMobileNumber,ElectronicPasswords,QueryOperatorRelatedInformation,CorporateAccountInformation},
  data() {
    return {
       // 账户信息
      caiConfig:{
        value:{'bankName':'ssss','accNo':'dddd'},
        disabled:false, // edit 状态下可用
        model:'view', // view 表示预览模式  edit  表示可编辑模式 默认值
        legalInfo:{} // 法人信息 {name:'', phone:'', cardNum:''}
      },
      // 经营者关联信息查询
      qoriConfig:{
        list:{},
        disabled:false, // edit 状态下可用
        model:'view', // view 表示预览模式  edit  表示可编辑模式 默认值
        DisplayWizard:false,
        // 经营者关联信息查询  编辑回显值
        defaultList: {'entTaxPic':{url:'https://zxcloud-test.oss-cn-hangzhou.aliyuncs.com/user/license/1688540243642_%E5%8A%9E%E5%85%AC.png',name:''},'entHirePic':{url:'https://zxcloud-test.oss-cn-hangzhou.aliyuncs.com/user/license/1688540248058_%E5%8C%97%E4%BA%AC2.png',name:''}},
      },
      sdfpConfig:{
        // 开票类型 1-传统票 2-数电票 3-混合票
        ticketType:'1',
        disabled:true,
        kpxe:'',
        state:'0',
        actionLabel:{0:'修改限额',1:'保存'},
        columns:[
          {
            title: '发票类型',
            dataIndex: 'type',

          },
          {
            title: '开票限额（月）',
            dataIndex: 'kpxe',
            scopedSlots: { customRender: 'kpxe' },
          },
          {
            title: '本月已占用金额',
            dataIndex: 'zyje',
            scopedSlots: { customRender: 'zyje' },
          },
          {
            title: '本月剩余可开金额',
            dataIndex: 'syje',
            scopedSlots: { customRender: 'syje' },
          },
          // {
          //   title: '操作',
          //   dataIndex: 'action',
          //   scopedSlots: { customRender: 'action' },
          // },
        ],
        data:[
          {type:'数电发票',kpxe:'10000',zyje:'2000',syje:'8000',}
        ]
      },
      PreviewShowConfig:{
        title:'',
        visible: false,
        loading: false,
        width: '50vw',
        height: '60vh',
        url:'',
        name:'',
        vhas:''
      },
      fpgl:tableCom,
      fpglDataSource:[
        { taxType: '普票', taxMedium: '纸质', ydhdsl:'-', syyl: '--', byly: '--', bysy: '--', dyyl: '--' },
        { taxType: '专票', taxMedium: '纸质', ydhdsl:'-', syyl: '--', byly: '--', bysy: '--', dyyl: '--' },
        { taxType: '普票', taxMedium: '电子', ydhdsl:'-', syyl: '--', byly: '--', bysy: '--', dyyl: '--' },
        { taxType: '专票', taxMedium: '电子', ydhdsl:'-', syyl: '--', byly: '--', bysy: '--', dyyl: '--' },

      ],
      EntMobileNumberConffig:{
        legalVisibleStatus:false,
        entId:'',
        datas:[]
      },
      formKey_qyxx: formKey_qyxx,
      pageFormDefaultConfig: pageFormConfig_,
      detailTableColumnList: detailConfig.detailTableColumnList,
      tempDetailConfig: detailConfig,
      // 税种征收方式 0-未设置 1-查账征收 2-核定征收-双定 3-核定征收-征收率 4-核定征收-应纳税所得率
      //20230901 用于判断 年度开票额度 的取值  当 核定税种 为 【核定征收-双定】 时 需要查询接口 否则为默认的 470万元
      // 20231103  双定模式用户，月开票额度字段后方金额修改为展示固定文字：“增值税、个人所得税双免政策额度内”
      taxMode:'',
      formList: {
        defaultForm: [
          { enName: 'invoiceMaxDesc', cnName: '年度开票额度', type: 'label', value: '', monoRow: false, itemAttr: { style: 'font-size: 16px; font-weight: 700;' }, formItemAttr: { ...formItemConfig0 } },
          { enName: 'protocolType111', cnName: '', type: 'label', value: '',itemAttr: { style:'font-size: 14px; font-weight: 700;'}, formItemAttr: { ...formItemConfig } },
          { enName: 'protocolType', cnName: '合作模式', type: 'label', value: '',itemAttr: { style:'font-size: 14px; font-weight: 700;'}, formItemAttr: { ...formItemConfig } },
          { enName: 'entId', cnName: '企业ID', type: 'label', value: '', formItemAttr: { ...formItemConfig } },
          {
            enName: 'taxMode', cnName: '核定税种', type: 'textGroup', value: [
              { type: 'text', label: '待定', border: true, isEvent: false },
              { type: 'link', label: '下载核定通知书', isEvent: true },
            ], itemAttr: { addonAfter: '@@' }, formItemAttr: { ...formItemConfig }
          },
          { enName: 'registerType', cnName: '企业类型', type: 'label', value: '', formItemAttr: { ...formItemConfig } },
          { enName: 'legalName', cnName: '企业负责人', type: 'label', value: '', formItemAttr: { ...formItemConfig } },
          { enName: 'businessPhone', cnName: '工商注册手机号', type: 'label', value: '---', formItemAttr: { ...formItemConfig } },
          {
            enName: 'serviceStart|serviceEnd', cnName: '服务期限', type: 'textGroup', value: [
              { type: 'text', label: '2022-03-01 ~ 2023-02-28', border: false, isEvent: false },
              // 20241202 按业务要求 去掉 勤税宝 企业端 企业管理 我的企业 列表详情中 在企业已设立状态下  服务期限 中的 服务续费 功能
              // { type: 'link', label: '服务续费', isEvent: true },
              { type: 'link', label: '', isEvent: false },
            ], formItemAttr: { ...formItemConfig }
          },
        ],
        otherForm: [
          { enName: 'entName', cnName: '企业名称', type: 'label', value: '', formItemAttr: { ...formItemConfig2 } },
          { enName: 'lisenceCreditCode', cnName: '社会信用统一代码', type: 'label', value: '', itemAttr: { addonAfter: '' }, formItemAttr: { ...formItemConfig3 } },
          { enName: 'lisenceIncorpDate', cnName: '注册时间', type: 'label', value: '', formItemAttr: { ...formItemConfig2 } },
          { enName: 'bankName', cnName: '开户行', type: 'label', value: '', formItemAttr: { ...formItemConfig2 } },
          { enName: 'legalName', cnName: '企业负责人', type: 'label', value: '', formItemAttr: { ...formItemConfig2 } },
          { enName: 'legalPhone', cnName: '负责人实名手机号', type: 'label', value: '', formItemAttr: { ...formItemConfig2 } },
          { enName: 'cardNumber', cnName: '负责人身份证号', type: 'label', value: '', formItemAttr: { ...formItemConfig3 } },
          { enName: 'bankAccountNo', cnName: '银行账户', type: 'label', value: '', formItemAttr: { ...formItemConfig2 } },
          { enName: 'lisenceAddress', cnName: '经营场所', type: 'label', monoRow: true, value: '', formItemAttr: { ...formItemConfig1 } },
          { enName: 'lisenceMgrNature', cnName: '经营范围', type: 'label', monoRow: true, value: '', formItemAttr: { ...formItemConfig1 } },
          { enName: 'licenseUrl', cnName: '营业执照', type: 'imgGroup', value: [], monoRow: true, formItemAttr: { ...formItemConfig1 } },

        ],
        qyfysmFrom:[
          { enName: 'invoiceMaxDesc', cnName: '注册服务费', type: 'label', value: '-元',  formItemAttr: { ...formItemConfig6 } },
          { enName: 'registerType', cnName: '开户服务费', type: 'label', value: '-元', formItemAttr: { ...formItemConfig6 } },
          { enName: 'serviceStart', cnName: '税务变更费', type: 'label', value: '-元', formItemAttr: { ...formItemConfig6 } },
          { enName: 'channelName', cnName: '服务年费', type: 'label', value: '-元', formItemAttr: { ...formItemConfig6 } },
          { enName: 'channelName', cnName: '工商变更费', type: 'label', value: '-元', formItemAttr: { ...formItemConfig6 } },
          { enName: 'channelName', cnName: '企业注销费', type: 'label', value: '-元起', formItemAttr: { ...formItemConfig6 } },

          { enName: 'channelName', cnName: '月开票额度限制', type: 'label', value: '-元 <= -元', formItemAttr: { ...formItemConfig6 } },
          { enName: 'channelName', cnName: '服务费模式', type: 'label', value: '-', formItemAttr: { ...formItemConfig6 } },
          { enName: 'channelName', cnName: '服务费率', type: 'label', value: '-%', formItemAttr: { ...formItemConfig6 } },

          { enName: 'entId', cnName: '企业服务模式', type: 'label', value: '-', formItemAttr: { ...formItemConfig6 } },
          { enName: 'taxMode', cnName: '企业服务模式说明', type: 'label', value: '-', monoRow: true, formItemAttr: { ...formItemConfig7 } },


        ]
      },
      tableConfig: {
        loading: false,
        tableData: [
          // { businessType: '银行开户', id2: '', businessStatus: '0', id4: '', action: '撤销并删除' },
          // { businessType: '税务变更', id2: '', businessStatus: '1', id4: '', action: '撤销并删除' },
          // { businessType: '邮寄资料', id2: '', businessStatus: '2', id4: '', action: '' },
          // { businessType: '电子签章', id2: '', businessStatus: '3', id4: '', action: '支付订单' },
          // { businessType: '企业服务模式变更', id2: '', businessStatus: '4', id4: '', action: '完善资料' },
          // { businessType: '个税申报', id2: '', businessStatus: '5', id4: '', action: '' },
          // { businessType: '注册信息变更', id2: '', businessStatus: '6', id4: '', action: '' },
          // { businessType: '企业注销', id2: '', businessStatus: '7', id4: '', action: '' },
          // { businessType: '税务申报', id2: '', businessStatus: '8', id4: '', action: '' },
        ],
        columns: detailConfig.jxzfwTableColumns,
        ipagination: {
          current: 1,
          pageSize: 10,
          total: 0,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return " 共" + total + "条"
          },
          showSizeChanger: true,
        }
      },
      // 用于存放企业详细信息
      qsbDetails: {},
      // 服务续费 订单信息
      orderListInfo:{},
      entId: '',
      winConfig: {
        visible: false,
        width:700,
        componentName: '',
      },
      btnGroupConfig: {
        // 是否有个税申报 false 没有 true 有
        // hasDJGS: false,
        btnList: [

          { label: '个税申报中',has:'ee_de11:click:gssbz', disabled: true, hasDJGS: !hasDJGS_ },
        ],
        btnListNew:[
          { label: '发票管理',has:'ee_de11:click:fpgl', disabled: false, hasDJGS: false },
          { label: '申请开票',has:'ee_de11:click:sqkp', disabled: false, hasDJGS: hasDJGS_ },
        ]

      }
    }
  },
  watch:{
    taxMode: {
      handler(val) {
        this.formList.defaultForm[0].cnName = '年度开票额度'
        if (!this.isType.isEmpty(val) && val == 2) {
          this.pageEvent('getTaxModeType',this.entId)
        }
      },
      deep: true,
      immediate: true
    },
  },
  mounted() {
    this.pageInit()
  },
  methods: {
    conversionElement1(val){
      return conversionElement(val)+' 元'
    },
    formatNumber,
    onBlur() {
      const {  tableItemChange } = this;
      let valueTemp = this.sdfpConfig.kpxe;
      const reg = /^-?[0-9]*(\.[0-9]*)?$/;
      if (!isNaN(valueTemp) && reg.test(valueTemp)) {
        // console.log('onBlur===>',valueTemp);
        tableItemChange({ value: valueTemp });
      }
    },
    tableItemChange(e){
      // console.log('Change事件 1==》',e);
      // console.log('Change事件 2==》',(e.target|| e).value);
      const { value } = e.target || e;
      const reg = /^-?[0-9]*(\.[0-9]*)?$/;
      if ((!isNaN(value) && reg.test(value)) || value === '' || value === '-') {
        if(this.sdfpConfig.data[0].zyje > conversionBranch(value)){
          this.$message.warning('【开票限额（月）】的值应大于【本月已占用金额】的值！')
        }
        this.sdfpConfig.kpxe = value
      }else{
        this.$message.warning('请输入数字')
      }
    },
    tableEvent_sd(itemData){
      const {state} = this.sdfpConfig
      // 允许编辑
      if(state=='0'){
        this.sdfpConfig.kpxe = conversionElement(this.sdfpConfig.data[0].kpxe)
        this.$nextTick(()=>{
          this.sdfpConfig.state = '1'
        })
      }
      // 保存数据
      if(state=='1'){
        const tempVal = conversionBranch(this.sdfpConfig.kpxe)
        if(this.sdfpConfig.data[0].zyje > tempVal){
          this.$message.warning('【开票限额（月）】的值应大于【本月已占用金额】的值！')
          return false
        }
        this.sdfpConfig.state = '0'
        this.sdfpConfig.data[0].kpxe = tempVal
        this.sdfpConfig.data[0].syje = this.sdfpConfig.data[0].kpxe - this.sdfpConfig.data[0].zyje
        this.pageEvent('setEntInvcAmount',{entId:this.entId,maxSdAmount:tempVal})
      }
    },


    PreviewShowEvent(){
      this.PreviewShowConfig.url = ''
      this.PreviewShowConfig.visible = false
    },
    legalModalHidden(){
      this.EntMobileNumberConffig.entId = ''
      this.EntMobileNumberConffig.legalVisibleStatus = false
    },
    pageEvent(type, ...args) {
      return pageEvent(type, this, ...args)
    },
    getActionLabel(record) {
      const val = record['businessStatus']
      let res = this.getStateData('TaskStatusActionLabel', val)
      if (res == '--') {
        res = ''
      }
      return res
    },
    getStateData(type, value) {
      // TaskStatus
      return detailConfig[type] && detailConfig[type][value] || '--'
    },
    goTo(type, record, index, indent) {
      console.log('goto==>', type, record, index, indent);
      // const stateActionList = {
      //   5:(record)=>{
      //     // 跳转到  企业服务模式升级 里面
      //     this.$message.info('企业服务模式升级')
      //   },
      //   34:(record)=>{
      //     // 跳转到支付页面  文乐提供
      //     console.log('跳转到支付页面  文乐提供==>',record);
      //   },
      //   0:(record)=>{
      //     // 调用后台接口进行删除
      //     console.log('调用后台接口进行删除 ==>',record);
      //   },
      //   1:(record)=>{
      //     // 调用后台接口进行删除
      //     console.log('调用后台接口进行删除 ==>',record);
      //   },
      // }
      const tempState = record['businessStatus']
      const tempTaskName = record['businessType']
      if (type === '1') {
        // 详情
        // const pageParam = this.getStateData('TaskName', tempTaskName)
        const pageParam = this.getStateData('TaskName', this.tempDetailConfig.ywlxObj[tempTaskName])
        // console.log('############################',pageParam,tempTaskName,this.tempDetailConfig.ywlxObj[tempTaskName],this.tempDetailConfig);
        if(pageParam==='--'){
          this.$message.warning('当前任务没有详情')
          return false
        }
        pageParam.data = record
        pageParam.entName = this.qsbDetails.entName
        pageParam.entId = this.entId
        pageParam.TaskStatus = this.getStateData('TaskStatus', tempState)

        Storage.set('enterpriseDetails1-page-data', pageParam)
        // const ll =Storage.get('enterpriseDetails1-page-data')
        console.log('详情===>', pageParam);
        this.$router.push({
          path: '/enterprise/enterpriseList/ServicesInProgress',
          query: {
            t: 'enterpriseDetails1-page-data'
          }
        });
      }
      // if(type==='2'){
      //   // 任务状态对应的操作
      //   stateActionList[tempState](record)
      // }
    },
    /**
     * 获取企业状态
     */
    getQYState(code) {
      let res = ''
      detailConfig.qystatus.forEach(item => {
        const { enName, cnName } = item
        if (code == enName) {
          res = cnName
        }
      })
      return res
    },
    formEvent(formName, type, data) {
      // qyxxForm textEvent 服务续费
      // qyxxForm textEvent 下载核定通知书
      console.log('enterpriseDetails formEvent===>', this, formName, type, data);
      // this.$attrs.itemData.value = data
      if (formName === 'qyxxForm' && type === 'textEvent' && data === '服务续费') {
        this.serviceRenew()
      }
      if (formName === 'qyxxForm' && type === 'textEvent' && data === '去支付') {
        this.toPay()
      }
      if (formName === 'qyxxForm' && type === 'textEvent' && data === '下载核定通知书') {
        this.downloadTZS()
      }

    },

    downloadTZS() {
      // this.winConfig.title = '下载核定通知书'
      // this.winConfig.visible = true

      console.log('此功能尚未开通==>',this.qsbDetails.checkInfo);
      if(!this.isType.isNullOrUnDef(this.qsbDetails.checkInfo)){
        // this.$message.info('没有数据')
        this.PreviewShowConfig.url = this.qsbDetails.checkInfo.fileUrl //'https://zxcloud-test.oss-cn-hangzhou.aliyuncs.com/qsb/contract/1687677495917_%E7%91%9E%E8%AE%AF.jpg'
        this.PreviewShowConfig.name = `有效期：${this.qsbDetails.checkInfo&&this.qsbDetails.checkInfo.valSdate||''}至${this.qsbDetails.checkInfo&&this.qsbDetails.checkInfo.valEdate||''}`
        this.PreviewShowConfig.visible = true
      }else{
        this.$message.warning('暂无核定通知书')
      }
      // this.$message.info('此功能尚未开通')
    },

    /**
     * 服务续费
     */
    serviceRenew() {
      this.winConfig.title = '服务续费'
      this.winConfig.componentName = 'ServiceRenew'
      this.winConfig.visible = true
    },
    /**
     * 服务续费 有进行中的续费订单 需要去支付
     */
    toPay() {
      const key = "ServiceRenew"
      Storage.set(key, { orderNo: this.orderListInfo.orderList })
      this.$router.push({
        path: '/myAccount/accountManage',
        query: {
          po: key
        }
      });
    },

    /**
     * 邮寄资料
     */
    mailingInformation() {
      this.winConfig.title = '领取资料'
      this.winConfig.componentName = 'MailingInformation'
      this.winConfig.visible = true
    },

    goBack() {
      this.$router.go(-1)
    },

    pageInit() {
      const id = this.$route.query.bizId
      // 用于控制业务弹框  2 表示服务续费  3 表示邮寄资料
      const pageType = this.$route.query.type
      this.entId = id
      this.pageEvent('getDataForEnterpriseDetails', id,1)
      this.pageEvent('ServicesInProgressData', id)
      this.pageEvent('getDataForfpglTableList', id)
      this.pageEvent('getQueryEntSvConf', id)
      this.sdfpConfig.disabled = false
      // 查询企业数电发票额度
      this.pageEvent('queryEntInvcAmount', {entId:id})
      const pageTypeAction = {
        // 下载核定通知书
        1:()=>{
          this.downloadTZS()
        },
        // 表示服务续费
        2:()=>{
          this.serviceRenew()
        },
        // 表示邮寄资料
        3:()=>{
          this.mailingInformation()
        },
      }
      pageTypeAction[pageType] && pageTypeAction[pageType]()
    },
    handleTableChange(pagination, filters, sorter) {
      // console.log('handleTableChange===>', pagination, filters, sorter);
      // current: 1, pageNo:1,
      // this.queryParam.current = pagination.current
      // this.queryParam.pageSize = pagination.pageSize
      // //分页、排序、筛选变化时触发
      // this.ipagination = pagination;
      // this.pageEvent('getDataForTableList')
    },
    /**
     * 弹窗的关闭事件
     */
    winColosedEvent() {
      this.winConfig.visible = false
    },
    async btnGroupEvent(item, index) {
      console.log('@@@@@@@@@@@@@@@@@@@@@@@',item);
      const btnLabel = item.label
      if (btnLabel === '发票管理') {
        //发票列表
        const id = this.$route.query.bizId
        this.$router.push({
          path: '/invoice/invoiceQueryNew',//'/invoice/invoiceQuery',
          query: {
            bizId: this.entId,
            entName: this.qsbDetails.entName
          }

        });
      }
      if (btnLabel === '申请开票') {

        const res = await this.pageEvent('getLegalInfo', this.entId)
      if(res.res===true){
        // 开票页面
        this.$router.push({
          path: '/invoice/applyInvoice',
          query: {
            bizId: this.entId
          }
        });
      }else{
        this.EntMobileNumberConffig.entId = this.entId
        this.EntMobileNumberConffig.legalVisibleStatus = true
        this.EntMobileNumberConffig.datas = res.data
      }

      }
      // invoice/applyInvoice
    }
  }
}
</script>

<style lang="less">
.card-title-detail1 {
  //font-size: 28px;
  font-size: 20px;
  font-family: PingFangSC-Semibold, PingFang SC;
  font-weight: 600;
  color: #333333;
}

.card-title-detail2 {
  //font-size: 20px;
  font-size: 16px;
  font-family: PingFangSC-Semibold, PingFang SC;
  font-weight: 600;
  color: #333333;
}

.ant-table-thead>tr>th,
.ant-table-tbody>tr>td {
  padding: 8px 16px;
}

.avtion-con {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding-left: 20px;
}

.ant-modal-content {
  .ant-modal-header {
    border-bottom: 1px solid #e8e8e8;

    .ant-modal-title {
      display: flex;
      justify-content: flex-start;
      align-items: center;
    }
  }
}

.ed1-con {
  .btn-group {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 300px;
    margin-bottom: -40px;
    position: absolute;
    z-index: 1;
    right: 0px;
  }
}
</style>

